<template>
  <div class="modifyPassword">
    <div class="user" v-if="isshow">
      <el-form
        :inline="true"
        :model="formInline"
        class="demo-form-inline"
        label-position="right"
        label-width="80px"
      >
        <el-form-item label="账号">
          <el-input
            v-model="formInline.userPhone"
            :disabled="true"
            placeholder="手机号"
          ></el-input>
        </el-form-item>
        <el-form-item label="密码">
          <el-input
            v-model="formInline.usermessagePwd"
            show-password
            placeholder="请输入密码"
          ></el-input>
        </el-form-item>
      </el-form>
      <div class="operation">
        <el-Button @click="submitBtn(formInline)">保存</el-Button>
        <el-Button @click="isshow = false">关闭</el-Button>
      </div>
    </div>
  </div>
</template>

<script>
import { modifyPsd } from "@/network/api/userme/userme";
import mitt from "@/utils/mitt";
export default {
  name: "Password",
  data() {
    return {
      isshow: false,
      formInline: {
        userPhone: "",
        usermessagePwd: "",
      },
    };
  },
  created() {
    mitt.on("isshowP", (res) => {
      this.isshow = res;
    });

    mitt.on("infopsd", (res) => {
      console.log(res, 222222);
      this.formInline.userPhone = res.userPhone;
    });
  },
  methods: {
    async submitBtn(data) {
      let modifyPassword = await modifyPsd(data);
      console.log(modifyPassword, "修改密码");
    },
    // 关闭
    colose() {
      mitt.emit("isshow", false);
    },
  },
};
</script>

<style scoped lang='scss'>
.modifyPassword {
  width: 100%;
  height: 100%;
  position: relative;
  .user {
    width: 55%;
    padding: 20px 30px;
    box-sizing: border-box;
    border-radius: 10px;
    background-color: rgb(194, 233, 239);
    position: absolute;
    top: -300px;
    left: 300px;
    z-index: 99;
  }
  .operation {
    margin-top: 20px;
    text-align: center;
  }
}
</style>